package com.hfkh.keyun.common;

public enum StatusCodeEnum {
    SC200(200, "操作成功"),
    SC999(999, "操作失败"),
    SC401(401, "匿名用户访问权限资源时的异常"),
    SC403(403, "无访问权限，请联系管理员授予权限"),
    SC404(404, "请求的资源不存在"),
    SC500(500, "系统异常，请稍后重试")
    ;
    private Integer code;
    private String message;

    StatusCodeEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public static StatusCodeEnum getMessage(Integer code) {
        for (StatusCodeEnum value : StatusCodeEnum.values()) {
            if(value.code == code) {
                return value;
            }
        }
        return null;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
